package com.kgc.storeprovider.controller;

import com.kgc.basic.util.ResponseMsg;
import com.kgc.store.remote.StoreGoodSummaryRemote;
import com.kgc.storeprovider.service.StoreGoodSummaryService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

@RestController
public class StoreGoodSummaryController implements StoreGoodSummaryRemote {

    private Logger logger = LoggerFactory.getLogger(StoreGoodSummaryController.class);

    @Autowired
    private StoreGoodSummaryService storeGoodSummaryService;

    @Override
    public ResponseMsg selectSummaryByStoreGood(Map<String, Object> map) {
        logger.info("StoreGoodSummaryController selectSummaryByStoreGood map:{}", map);
        ResponseMsg msg = storeGoodSummaryService.selectSummaryByStoreGood(map);
        logger.debug("StoreGoodSummaryController selectSummaryByStoreGood msg:{}", msg);
        return msg;
    }

    @Override
    public ResponseMsg selectAll() {
        logger.info("StoreGoodSummaryController selectAll is start...");
        ResponseMsg msg = storeGoodSummaryService.selectAll();
        logger.debug("StoreGoodSummaryController selectAll msg:{}", msg);
        return msg;
    }

    @Override
    public ResponseMsg selectSummaryByGoodsTransactionDetail(Map<String, Object> map) {
        logger.info("StoreGoodSummaryController selectSummaryByGoodsTransactionDetail map:{}", map);
        ResponseMsg msg = storeGoodSummaryService.selectSummaryByGoodsTransactionDetail(map);
        logger.debug("StoreGoodSummaryController selectSummaryByGoodsTransactionDetail msg:{}", msg);
        return msg;
    }

    @Override
    public ResponseMsg selectSummaryByBatchTrackingDetail(Map<String, Object> map) {
        logger.info("StoreGoodSummaryController selectSummaryByBatchTrackingDetail map:{}", map);
        ResponseMsg msg = storeGoodSummaryService.selectSummaryByBatchTrackingDetail(map);
        logger.debug("StoreGoodSummaryController selectSummaryByBatchTrackingDetail msg:{}", msg);
        return msg;
    }


//    @Override
//    public ResponseMsg updateStore(int gid, int sid, int stock) {
//        logger.info("StoreGoodSummaryController updateStore gid:{}", gid);
//        ResponseMsg msg = storeGoodSummaryService.updateStore(gid, sid, stock);
//        logger.debug("StoreGoodSummaryController updateStore msg:{}", msg);
//        return msg;
//    }

    @Override
    public ResponseMsg method(Map<String, Object> map) {
        logger.info("StoreGoodSummaryController method map:{}", map);
        ResponseMsg msg = storeGoodSummaryService.method(map);
        logger.debug("StoreGoodSummaryController method msg:{}", msg);
        return msg;
    }

    @Override
    public ResponseMsg selectKcStoreGoodBySidCid(@RequestParam("sid") int sid, @RequestParam("gid") int gid) {
        logger.info("StoreGoodSummaryController selectKcStoreGoodBySidCid sid:{},gid:{}", sid, gid);
        ResponseMsg msg = storeGoodSummaryService.selectKcStoreGoodBySidCid(sid, gid);
        logger.debug("StoreGoodSummaryController selectKcStoreGoodBySidCid msg:{}", msg);
        return msg;
    }

    @Override
    public ResponseMsg getTotalInventoryCost() {
        logger.info("StoreGoodSummaryController getTotalInventoryCost is start...");
        ResponseMsg msg = storeGoodSummaryService.getTotalInventoryCost();
        logger.debug("StoreGoodSummaryController getTotalInventoryCost msg:{}",msg);
        return msg;
    }
}
